package day240529;

import java.io.File;

public class Test5 {
    public static void main(String[] args) {
        String s = "";
        File root = new File("src/day240519_report");
        System.out.println(root.getName());
        showByTree(root, s);
    }

    private static void showByTree(File root, String s) {
        s += "--";
        for (File file : root.listFiles()) {

            if (file.isDirectory()) {
                System.out.println(s + file.getName());
                showByTree(file, s);
            } else {
                System.out.println(s + file.getName() + " 文件大小：" +file.length() + "字节");
            }
        }
    }

}
